<template>
  <div class="app-container">
    <!-- <strong>讲师列表</strong> -->
    <!--查询表单-->
    <!-- 表格 -->
    <el-table
      :data="list"
      style="width: 100%"
    >
      <el-table-column type="expand">
        <template slot-scope="props">
          <el-form label-position="left" inline class="demo-table-expand">
            <el-form-item label="未通过原因">
              <span>{{ props.row.reason }}</span>
            </el-form-item>
          </el-form>
        </template>
      </el-table-column>

      <el-table-column
        label="序号"
        width="70"
        align="center"
      >
        <template slot-scope="scope">
          {{ (page - 1) * limit + scope.$index + 1 }}
        </template>
      </el-table-column>

      <!--      <el-table-column label="教师工号" prop="jobNumber" align="center"/>-->

      <!--      <el-table-column label="教师姓名" prop="name" align="center"/>-->

      <el-table-column label="成果名称" prop="achievementName" align="center"/>

      <el-table-column label="所属分类" prop="subCategory" align="center"/>

      <el-table-column label="审核状态" prop="state" align="center">
        <template slot-scope="scope">
          <span v-if="scope.row.state === 0">待审阅</span>
          <span v-if="scope.row.state === 1">未通过</span>
          <span v-if="scope.row.state === 2">通过</span>
        </template>
      </el-table-column>

      <el-table-column label="提交时间" prop="subTime" align="center"/>

      <el-table-column label="审阅时间" prop="updateTime" align="center"/>

      <el-table-column label="操作" width="200" align="center">
        <template slot-scope="scope">
          <el-button type="text" size="50px" icon="el-icon-folder-opened" @click="openFile(scope.row.material)">
            查看文件
          </el-button>
<!--          <el-button type="text" size="50px" icon="el-icon-error" @click="openFile(scope.row.material)">-->
<!--            删除-->
<!--          </el-button>-->
        </template>
      </el-table-column>

    </el-table>

    <!-- 分页 -->
    <el-pagination
      :current-page="page"
      :page-size="limit"
      :total="total"
      style="padding: 30px 0; text-align: center;"
      layout="total, prev, pager, next, jumper"
      @current-change="getList"
    />


  </div>
</template>

<script>
// import teacher from '@/api/adm/teacherAdmin'
import * as teacher from '@/api/edu/eduTeacher'
import { disable, disableTeacher } from '@/api/adm/teacherAdmin'
import { historyAll } from '@/api/edu/eduTeacher'

export default {
  data() {
    return {
      list: null, // 查询之后接口返回集合
      page: 1, // 当前页
      limit: 10, // 每页记录数
      total: 0, // 总记录数
    }
  },
  created() {
    this.getList()
  },
  methods: {
    // 条件查询教师信息
    getList(page = 1) {
      this.page = page
      teacher.historyResult(this.page, this.limit)
        .then(response => {
          // 请求成功
          // response接口返回的数据
          // console.log(response)
          this.list = response.data.rows
          this.total = response.data.total
          console.log(this.list)
          console.log(this.total)
        })
    },
    openFile(fileUrl) {
      window.location.href = fileUrl
    },
    //清空要查询的内容
    resetData() {
      this.teacherQuery = {}
      this.getList()
    },
  }
}
</script>
<style>
.demo-table-expand {
  font-size: 0;
}

.demo-table-expand label {
  width: 90px;
  color: #99a9bf;
}

.demo-table-expand .el-form-item {
  margin-right: 0;
  margin-bottom: 0;
  width: 50%;
}

.edit-button {
  color: rgb(195, 176, 145); /* 紫色 */
}

.disable-button {
  color: rgb(81, 161, 187); /* 蓝色 */
}

.delete-button {
  color: rgb(255, 140, 140); /* 红色 */
}
</style>
